package com.platform.usercenter.controller;

import com.platform.common.core.web.domain.AjaxResult;
import com.platform.usercenter.domain.dto.SysUserCustomDTO;
import com.platform.usercenter.domain.dto.ThemeDTO;
import com.platform.usercenter.domain.vo.SysUserCustomVO;
import com.platform.usercenter.service.ISysUserCustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/userCustom")
public class SysUserCustomController {

    @Resource
    private ISysUserCustomService userCustomService;

    @GetMapping("/queryUserCustomSetting")
    public AjaxResult queryUserCustomSetting(){
        //查询用户自定义设置
        SysUserCustomVO userCustomVO = userCustomService.queryUserCustomSetting();
        return AjaxResult.success(userCustomVO);
    }

    /**
     * 用户显隐列设置
     * @param colInfo
     * @return
     */
    @PostMapping("/saveColSetting")
    public AjaxResult saveColSetting(@RequestBody SysUserCustomDTO colInfo){
        userCustomService.saveColSetting(colInfo);
        return AjaxResult.success();
    }

    /**
     * 用户主题设置
     * @param themeDTO
     * @return
     */
    @PostMapping("/saveThemeSetting")
    public AjaxResult saveThemeSetting(@RequestBody ThemeDTO themeDTO){
        userCustomService.saveThemeSetting(themeDTO);
        return AjaxResult.success();
    }

}
